﻿#include "fiveheadprecisionsewing.h"

FiveHeadPrecisionSewing::FiveHeadPrecisionSewing()
{


    //添加各种参数到列表中
    initRootParasList();
    initRootHMIConfigurationList(m_allParasList);//超级用户界面配置
    initPatternsParasList();
    initSoftwareParasList(m_allParasList);
    initTimeParasList(m_allParasList);
    initMcParasList();
    initWkParasList();

    //初始化控制动作列表
    initOutCtrlList();

    //初始化快捷功能列表
    initShortCutList();

    //初始化辅助功能列表
    initAssistList();

    //初始化花样设置功能列表
    initPatternSetList();

    //参数分类功能
    initParaSetList();

    //初始化传感器列表
    initSensorList();

    //初始化错误代码和状态列表
    initErrorCodeAndStateList();

    //初始化九宫格
    initNinebtn1234();

    //加载右上角信息
    initFileInfoLabel();
}

FiveHeadPrecisionSewing::~FiveHeadPrecisionSewing()
{

}

void FiveHeadPrecisionSewing::initNinebtn1234()
{
    m_nineBtn.insert(1,NineItem(FUN_HEAD_LIFTING,"buttonHeadLifting"));
    m_nineBtn.insert(2,NineItem(FUN_FORWARDORBACK,"buttonForwardOrBack"));
    m_nineBtn.insert(3,NineItem(FUN_PROCESSRESET,"buttonProcessReset"));
    m_nineBtn.insert(4,NineItem(FUN_SIMULATED_STATUS,"buttonSimulatedStatus"));
}

void FiveHeadPrecisionSewing::initFileInfoLabel()
{
    m_fileInfo.append(FileName);
    m_fileInfo.append(Index);
    m_fileInfo.append(BeginPoint);
    m_fileInfo.append(Range);
    m_fileInfo.append(Position);
    m_fileInfo.append(Production);
}

//花样参数
void FiveHeadPrecisionSewing::initPatternsParasList()
{
    //QTextCodec *cod = QTextCodec::codecForLocale();

    //花样参数-花样设置参数-起始点x；范围-1000000--1000000，单位0.01mm，默认 0
    m_allParasList.append(makeAParaItem(0,
                                        PARA_TYPE_PATTERN,
                                        PATTERNPARA_SORT_DSTR ,
                                        SET_STARTX, 0, 0, PARA_VALUE_TYPE_INT,
                                        tr("startX"),//起始点X
                                        0, -1000000, 1000000, 0, 2, tr("mm"), tr(""),//mm
                                        tr(""), 0, 0,0x0003, operate));

    //花样参数-花样设置参数-起始点y；范围-1000000--1000000，单位0.01mm，默认 0
    m_allParasList.append(makeAParaItem(0,
                                        PARA_TYPE_PATTERN,
                                        PATTERNPARA_SORT_DSTR ,
                                        SET_STARTY, 0, 0, PARA_VALUE_TYPE_INT,
                                        tr("startrY"),//起始点Y
                                        0, -1000000, 1000000, 0, 2, tr("mm"), tr(""),//mm
                                        tr(""), 0, 0,0x0004, operate));

    
#if 0

        //花样参数-花样设置参数-定位点x；范围-1000000--1000000，单位0.01mm，默认 0
        m_allParasList.append(makeAParaItem(0,
                                            PARA_TYPE_PATTERN,
                                            PATTERNPARA_SORT_DSTR,
                                            SET_ANCHORX, 0, 0, PARA_VALUE_TYPE_INT,
                                            tr("AnchorX"),//定位点X
                                            0, -1000000, 1000000, 0, 2, tr("mm"), tr(""),//mm
                                            tr(""), 0, 0,0x0001, operate));

        //花样参数-花样设置参数-定位点y；范围-1000000--1000000，单位0.01mm，默认 0
        m_allParasList.append(makeAParaItem(0,
                                            PARA_TYPE_PATTERN,
                                            PATTERNPARA_SORT_DSTR ,
                                            SET_ANCHORY, 0, 0, PARA_VALUE_TYPE_INT,
                                            tr("AnchorY"),//定位点Y
                                            0, -1000000, 1000000, 0, 2, tr("mm"), tr(""),//mm
                                            tr(""), 0, 0,0x0002, operate));

    //花样参数-花样设置参数-左边；单位：毫米 ，范围0-10000，默认0
    m_allParasList.append(makeAParaItem(0,
                                        PARA_TYPE_PATTERN,
                                        PATTERNPARA_SORT_DSTR | PATTERNPARA_SORT_QUI,
                                        SET_SETLEFT, 0, 0, PARA_VALUE_TYPE_INT,
                                        tr("Left"),//左边
                                        0, 0, 10000, 0, 1, tr("mm"), tr(""),
                                        tr(""),
                                        0, 0, 0x0010, operate));

    //花样参数-花样设置参数-前边；单位：毫米 ，范围0-10000，默认0
    m_allParasList.append(makeAParaItem(0,
                                        PARA_TYPE_PATTERN,
                                        PATTERNPARA_SORT_DSTR | PATTERNPARA_SORT_QUI,
                                        SET_SETFRONT, 0, 0, PARA_VALUE_TYPE_INT,
                                        tr("Front"),//前边
                                        0, 0, 10000, 0, 1, tr("mm"), tr(""),
                                        tr(""),
                                        0, 0, 0x0011, operate));
    
#endif

}

//机器参数
void FiveHeadPrecisionSewing::initMcParasList()
{
    //    QTextCodec *cod = QTextCodec::codecForLocale();

    //x可移动区域正边界(X+), 范围 -10000.00--10000.00,单位0.01mm
    m_allParasList.append(makeAParaItem(0,
                                        PARA_TYPE_MACH,
                                        MC_SORT_SETTING,
                                        2, 0, 0, PARA_VALUE_TYPE_INT,
                                        tr("X movable area positive boundary"),//x可移动区域正边界(X+)
                                        0, -1000000, 1000000, 0, 2, tr("mm"), tr(""),
                                        tr(""),
                                        0, 0, 0x0028, operate));

    // y可移动区域正边界(Y+), 范围 -10000.00--10000.00,单位0.01mm
    m_allParasList.append(makeAParaItem(0,
                                        PARA_TYPE_MACH,
                                        MC_SORT_SETTING,
                                        3, 0, 0, PARA_VALUE_TYPE_INT,
                                        tr("Y movable area positive boundary"),//y可移动区域正边界(Y+)
                                        0, -1000000, 1000000, 0, 2, tr("mm"), tr(""),
                                        tr(""),
                                        0, 0, 0x0029, operate));

    // x可缝纫区域负边界(X-), 范围 -10000.00--10000.00,单位0.01mm
    m_allParasList.append(makeAParaItem(0,
                                        PARA_TYPE_MACH,
                                        MC_SORT_SETTING,
                                        4, 0, 0, PARA_VALUE_TYPE_INT,
                                        tr("X Sewing area Negative boundary"),//x可缝纫区域负边界(X-)
                                        0, -1000000, 1000000, 0, 2, tr("mm"), tr(""),
                                        tr(""),
                                        0, 0, 0x0030, operate));

    // x可缝纫区域正边界(X+), 范围 -10000.00--10000.00,单位0.01mm
    m_allParasList.append(makeAParaItem(0,
                                        PARA_TYPE_MACH,
                                        MC_SORT_SETTING,
                                        5, 0, 0, PARA_VALUE_TYPE_INT,
                                        tr("X Sewing area positive boundary"),//x可缝纫区域正边界(X+)
                                        0, -1000000, 1000000, 0, 2, tr("mm"), tr(""),
                                        tr(""),
                                        0, 0, 0x0031, operate));

    // y可缝纫区域负边界(Y-), 范围 -10000.00--10000.00,单位0.01mm
    m_allParasList.append(makeAParaItem(0,
                                        PARA_TYPE_MACH,
                                        MC_SORT_SETTING,
                                        6, 0, 0, PARA_VALUE_TYPE_INT,
                                        tr("Y Sewing area Negative boundary"),//y可缝纫区域负边界(Y-)
                                        0, -1000000, 1000000, 0, 2, tr("mm"), tr(""),
                                        tr(""),
                                        0, 0, 0x0032, operate));


    // y可缝纫区域正边界(Y+), 范围 -10000.00--10000.00,单位0.01mm
    m_allParasList.append(makeAParaItem(0,
                                        PARA_TYPE_MACH,
                                        MC_SORT_SETTING,
                                        7, 0, 0, PARA_VALUE_TYPE_INT,
                                        tr("Y Sewing area positive boundary"),// y可缝纫区域正边界(Y+)
                                        0, -1000000, 1000000, 0, 2, tr("mm"), tr(""),
                                        tr(""),
                                        0, 0, 0x0033, operate));

    // 机头2零位坐标,范围 0--4000.0,单位0.1mm
    m_allParasList.append(makeAParaItem(0,
                                        PARA_TYPE_MACH,
                                        MC_SORT_SETTING,
                                        8, 0, 0, PARA_VALUE_TYPE_INT,
                                        tr("Zero position coordinate of head 2"),// 机头2零位坐标
                                        0, 0, 40000, 0, 1, tr("mm"), tr(""),
                                        tr(""),
                                        0, 0, 0x0023, operate));

    // 机头3零位坐标,范围 0--4000.0,单位0.1mm
    m_allParasList.append(makeAParaItem(0,
                                        PARA_TYPE_MACH,
                                        MC_SORT_SETTING,
                                        9, 0, 0, PARA_VALUE_TYPE_INT,
                                        tr("Zero position coordinate of head 3"),// 机头3零位坐标
                                        0, 0, 40000, 0, 1, tr("mm"), tr(""),
                                        tr(""),
                                        0, 0, 0x0024, operate));

    // 机头4零位坐标,范围 0--4000.0,单位0.1mm
    m_allParasList.append(makeAParaItem(0,
                                        PARA_TYPE_MACH,
                                        MC_SORT_SETTING,
                                        10, 0, 0, PARA_VALUE_TYPE_INT,
                                        tr("Zero position coordinate of head 4"),// 机头4零位坐标
                                        0, 0, 40000, 0, 1, tr("mm"), tr(""),
                                        tr(""),
                                        0, 0, 0x0025, operate));

    // 机头5零位坐标,范围 0--4000.0,单位0.1mm
    m_allParasList.append(makeAParaItem(0,
                                        PARA_TYPE_MACH,
                                        MC_SORT_SETTING,
                                        11, 0, 0, PARA_VALUE_TYPE_INT,
                                        tr("Zero position coordinate of head 5"),// 机头5零位坐标
                                        0, 0, 40000, 0, 1, tr("mm"), tr(""),
                                        tr(""),
                                        0, 0, 0x0026, operate));

}

//工作参数
void FiveHeadPrecisionSewing::initWkParasList()
{
    QTextCodec *cod = QTextCodec::codecForLocale();
    // 主轴缝纫工作转速, 范围 1--500,单位r/min,默认 300
    m_allParasList.append(makeAParaItem(0,
                                        PARA_TYPE_WORK,
                                        MC_SORT_SPEED,
                                        0, 0, 0, PARA_VALUE_TYPE_INT,
                                        tr("sewing work speed"),// 主轴缝纫工作转速
                                        300, 1, 500, 300, 0, tr("r/min"), tr(""),
                                        tr(""), 0, 0, 0x0001, operate));
    // 主轴剪线转速, 范围 1--500,单位r/min,默认 120
    m_allParasList.append(makeAParaItem(0,
                                        PARA_TYPE_WORK,
                                        MC_SORT_SPEED,
                                        1, 0, 0, PARA_VALUE_TYPE_INT,
                                        tr("Spindle thread cutting speed"),// 主轴剪线转速
                                        120, 1, 500, 120, 0, tr("r/min"), tr(""),
                                        tr(""), 0, 0, 0x0001, operate));

    // 缝纫动框方式, 位图
    // bit0 = 0, xy连续动框; bit = 1, xy间歇式动框;
    m_allParasList.append(makeAParaItem(0,
                                        PARA_TYPE_WORK,
                                        MC_SORT_ACTION,
                                        2, 1, 0, PARA_VALUE_TYPE_LIST,
                                        tr("Sewing motion frame method"),// 缝纫动框方式
                                        0, 0, 1, 0, 0, tr(""), tr(""),
                                        tr("Xy continuous moving box:0;Xy intermittent moving frame:1"), 0, 0, 0x0007, operate));// bit0 = 0, xy连续动框; bit = 1, xy间歇式动框;

    // 起针动作允许; 位图选择, 0, 不允许; 1, 允许;
    // bit0, 松线允许;
    m_allParasList.append(makeAParaItem(0,
                                        PARA_TYPE_WORK,
                                        MC_SORT_ACTION,
                                        3, 1, 0, PARA_VALUE_TYPE_SW,
                                        tr("Allow for needle starting and thread loosening"),// 起针松线允许
                                        0, 0, 1, 0, 0, tr(""), tr(""),
                                        tr(""), 0, 0, 0x0008, operate));

    // 剪线允许; 0, 不剪线; 1, 剪线
    m_allParasList.append(makeAParaItem(0,
                                        PARA_TYPE_WORK,
                                        MC_SORT_ACTION,
                                        4, 0, 0, PARA_VALUE_TYPE_SW,
                                        tr("Thread cutting allowed"),// 剪线允许
                                        0, 0, 1, 0, 0, tr(""), tr(""),
                                        tr(""), 0, 0, 0x0003, operate));// 0, 不剪线; 1, 剪线

    // 剪线时动作允许, 位图选择,
    // bit0, 松线允许;
    m_allParasList.append(makeAParaItem(0,
                                        PARA_TYPE_WORK,
                                        MC_SORT_ACTION,
                                        5, 1, 0, PARA_VALUE_TYPE_SW,
                                        tr("Allow for loose thread during thread cutting"),// 剪线时松线允许
                                        0, 0, 1, 0, 0, tr(""), tr(""),
                                        tr(""), 0, 0, 0x0009, operate));
    // bit2, 夹线允许; 0, 不允许; 1, 允许;
    m_allParasList.append(makeAParaItem(0,
                                        PARA_TYPE_WORK,
                                        MC_SORT_ACTION,
                                        5, 3, 0, PARA_VALUE_TYPE_SW,
                                        tr("Allowing for wire clamping during wire cutting"),// 剪线时夹线允许
                                        0, 0, 1, 0, 0, tr(""), tr(""),
                                        tr(""), 0, 0, 0x0009, operate));
    // bit7, 退针允许；0:允许 1:不允许
    m_allParasList.append(makeAParaItem(0,
                                        PARA_TYPE_WORK,
                                        MC_SORT_ACTION,
                                        5, 8, 0, PARA_VALUE_TYPE_SW,
                                        tr("Allow needle withdrawal during thread cutting"),// 剪线时退针允许
                                        0, 0, 1, 0, 0, tr(""), tr(""),
                                        tr(""), 0, 0, 0x0009, operate));

    // 断线检测针数; 0, 不检测断线; 其他, 断线信号连续针数, 默认3 断线检测0~10
    m_allParasList.append(makeAParaItem(0,
                                        PARA_TYPE_WORK,
                                        MC_SORT_DETECT,
                                        6, 0, 0, PARA_VALUE_TYPE_INT,
                                        tr("No. of stitch detect if thread broken"),// 断线检测针数
                                        3, 0, 10, 3, 0, tr(""), tr(""),
                                        tr(""), 0, 0, 0x0002, operate));

    // 换梭芯提醒功能, 0, 不启用该功能; 1, 按长度计数延迟提醒; 2, 按片数计数; 3, 按长度立刻提醒; 默认0
    m_allParasList.append(makeAParaItem(0,
                                        PARA_TYPE_WORK,
                                        MC_SORT_ACTION,
                                        7, 0, 0, PARA_VALUE_TYPE_LIST,
                                        tr("Bobbin change reminder function"),// 换梭芯提醒功能
                                        0, 0, 3, 0, 0, tr(""), tr(""),
                                        //0, 不启用该功能; 1, 按长度计数延迟提醒; 2, 按片数计数; 3, 按长度立刻提醒; 默认0
                                        tr("Not enabled:0;Delay reminder by length:1;Count by number of slices:2;Immediately reminder by length:3"), 0, 0, 0x0012, operate));

    // 底线长度, 单位 0.01mm,默认 10000000  底线长度1~100000.00
    m_allParasList.append(makeAParaItem(0,
                                        PARA_TYPE_WORK,
                                        MC_SORT_SETTING,
                                        8, 0, 0, PARA_VALUE_TYPE_INT,
                                        tr("Bobbin thread length"),// 底线长度
                                        10000000, 1, 10000000, 10000000, 2, tr("mm"), tr(""),
                                        tr(""),
                                        0, 0, 0x0013, operate));

    // 换梭片数计数, 单位 次,默认 0 片数1~1000
    m_allParasList.append(makeAParaItem(0,
                                        PARA_TYPE_WORK,
                                        MC_SORT_SETTING,
                                        9, 0, 0, PARA_VALUE_TYPE_INT,
                                        tr("Count of shuttle change pieces"),// 换梭片数计数
                                        0, 1, 1000, 0, 0, tr("Times"), tr(""),
                                        tr(""),
                                        0, 0, 0x0014, operate));

    // 加油方式选择, 0, 不加油; 1, 按工作时间间歇加油; 2, 按工作针数间歇加油; 3, 持续不停加油,默认0
    m_allParasList.append(makeAParaItem(0,
                                        PARA_TYPE_WORK,
                                        MC_SORT_SETTING,
                                        10, 0, 0, PARA_VALUE_TYPE_LIST,
                                        tr("Refueling method selection"),// 加油方式选择
                                        0, 1, 3, 0, 0, tr(""), tr(""),
                                        // 0, 不加油; 1, 按工作时间间歇加油; 2, 按工作针数间歇加油; 3, 持续不停加油,
                                        tr("not refueling:0;According to worktime:1;According to the stitches number:2;Continuously refueling:3"),0, 0, 0x0016, operate));

    // 加油针数间隔, 单位针, 加油方式为按针数加油时有用,默认 10000  加油间隔0~10000
    m_allParasList.append(makeAParaItem(0,
                                        PARA_TYPE_WORK,
                                        MC_SORT_SETTING,
                                        11, 0, 0, PARA_VALUE_TYPE_INT,
                                        tr("Interval between refueling stitches"),// 加油针数间隔
                                        10000, 0, 1000000, 10000, 0, tr(""), tr(""),
                                        tr(""),0, 0, 0x0017, operate));

    // 加油持续时长, 单位秒, 加油时长0~60秒  默认0
    m_allParasList.append(makeAParaItem(0,
                                        PARA_TYPE_WORK,
                                        MC_SORT_SETTING,
                                        13, 0, 0, PARA_VALUE_TYPE_INT,
                                        tr("Refueling duration"),// 加油持续时长
                                        0, 0, 60, 0, 0, tr("second"), tr(""), //秒
                                        tr(""),0, 0, 0x0018, operate));

    // 剪线分线角度，0--36000, 单位 0.01度，默认 20000
    m_allParasList.append(makeAParaItem(0,
                                        PARA_TYPE_WORK,
                                        MC_SORT_SETTING,
                                        15, 0, 0, PARA_VALUE_TYPE_INT,
                                        tr("Cutting and parting angle"),// 剪线分线角度
                                        20000, 0, 36000, 20000, 2, cod->toUnicode("°"), tr(""), //度
                                        tr(""),0, 0, 0x0018, operate));

    // 剪线完成角度，0--36000, 单位 0.01度，默认 6000
    m_allParasList.append(makeAParaItem(0,
                                        PARA_TYPE_WORK,
                                        MC_SORT_SETTING,
                                        16, 0, 0, PARA_VALUE_TYPE_INT,
                                        tr("Thread trimming completion angle"),// 剪线完成角度
                                        6000, 0, 36000, 6000, 2, cod->toUnicode("°"), tr(""), //度
                                        tr(""),0, 0, 0x0018, operate));
     // 面线夹线针数，0--5，单位 针，默认0
    m_allParasList.append(makeAParaItem(0,
                                        PARA_TYPE_WORK,
                                        MC_SORT_SETTING,
                                        17, 0, 0, PARA_VALUE_TYPE_INT,
                                        tr("Number of stitches for surface thread clamping"),// 面线夹线针数
                                        0, 0, 5, 0, 0, tr(""), tr(""),
                                        tr(""),0, 0, 0x0019, operate));

    ///////////////////////////////////////////////////////////////////////////////////////

    // 产量预设
    m_allParasList.append(makeAParaItem(0,
                                        PARA_TYPE_WORK,
                                        MC_SORT_SETTING,
                                        21, 0, 0, PARA_VALUE_TYPE_INT,
                                        tr("Production preset"),// 产量预设
                                        0, 0, S32_MAX, 0, 0, tr(""), tr(""),
                                        tr(""),0, 0, 0x0004, operate));

    // 缝纫时动作允许, 0, 不允许; 1, 允许;
    // bit1 自动回穿线点允许;
    m_allParasList.append(makeAParaItem(0,
                                        PARA_TYPE_WORK,
                                        MC_SORT_SETTING,
                                        23, 1, 0, PARA_VALUE_TYPE_SW,
                                        tr("Automatically thread back points during sewing"),// 缝纫时自动回穿线点
                                        0, 0, 1, 0, 0, tr(""), tr(""),
                                        tr(""),0, 0, 0x0010, operate));

    // 移框时动作选择; 位图选择, 0, 不允许; 1, 允许;
    // bit0, 松线允许;
    m_allParasList.append(makeAParaItem(0,
                                        PARA_TYPE_WORK,
                                        MC_SORT_SETTING,
                                        25, 1, 0, PARA_VALUE_TYPE_SW,
                                        tr("Allow for loose lines when moving boxes"),//移框时松线允许
                                        0, 0, 1, 0, 0, tr(""), tr(""),
                                        tr(""),0, 0, 0x011, operate));

    // 软件限位; 位图选择, 0, 不允许; 1, 允许;
    // bit0, xy移动;
    m_allParasList.append(makeAParaItem(0,
                                        PARA_TYPE_WORK,
                                        MC_SORT_SETTING,
                                        26, 1, 0, PARA_VALUE_TYPE_SW,
                                        tr("Software limit: xy movement"),// 软件限位:xy移动
                                        0, 0, 1, 0, 0, tr(""), tr(""),
                                        tr(""),0, 0, 0x0027, operate));

    // 缝纫降速: 0 不降速   1 降速
    m_allParasList.append(makeAParaItem(0,
                                        PARA_TYPE_WORK,
                                        MC_SORT_SETTING,
                                        31, 0, 0, PARA_VALUE_TYPE_SW,
                                        tr("Automatic sewing speed regulation"),// 缝纫降速
                                        0, 0, 2, 0, 0, tr(""), tr(""),
                                        tr(""),0, 0, 0x0006, operate));// 1降速,2不降速

    // 循环工作功能,0, 不允许; 1, 允许;
    m_allParasList.append(makeAParaItem(0,
                                        PARA_TYPE_WORK,
                                        MC_SORT_SETTING,
                                        34, 1, 0, PARA_VALUE_TYPE_SW,
                                        tr("Circular working function"),// 循环工作功能
                                        0, 0, 1, 0, 0, tr(""), tr(""),
                                        tr(""),0, 0, 0x0005, operate));

    // 梭加油持续时长, 单位秒, (针梭独立加油时有效)
    m_allParasList.append(makeAParaItem(0,
                                        PARA_TYPE_WORK,
                                        MC_SORT_SETTING,
                                        35, 0, 0, PARA_VALUE_TYPE_INT,
                                        tr("Duration of shuttle refueling"),// 梭加油持续时长
                                        0, 0, 60, 0, 0, tr("second"), tr(""), //秒
                                        tr(""),0, 0, 0x0019, operate));

    // 缝纫吹气时间,范围0-10,单位s,默认0（0为持续吹气）
    m_allParasList.append(makeAParaItem(0,
                                        PARA_TYPE_WORK,
                                        MC_SORT_SETTING,
                                        36, 0, 0, PARA_VALUE_TYPE_INT,
                                        tr("Sewing and blowing time"),// 缝纫吹气时间
                                        0, 0, 10, 0, 0, tr("second"), tr(""), //秒
                                        tr(""),0, 0, 0x0015, operate));

    // 缝纫动框起始角度, 0--36000, 单位 0.01度，默认 28000
    m_allParasList.append(makeAParaItem(0,
                                        PARA_TYPE_WORK,
                                        MC_SORT_SETTING,
                                        37, 0, 0, PARA_VALUE_TYPE_INT,
                                        tr("Starting angle of sewing frame"),// 缝纫动框起始角度
                                        28000, 0, 36000, 28000, 2, cod->toUnicode("°"), tr(""), //度
                                        tr(""),0, 0, 0x0021, operate));

    // 缝纫勾线角度, 0--36000, 单位 0.01度，默认 20200
    m_allParasList.append(makeAParaItem(0,
                                        PARA_TYPE_WORK,
                                        MC_SORT_SETTING,
                                        38, 0, 0, PARA_VALUE_TYPE_INT,
                                        tr("Sewing hook angle"),// 缝纫勾线角度
                                        20200, 0, 36000, 20200, 2, cod->toUnicode("°"), tr(""), //度
                                        tr(""),0, 0, 0x0021, operate));

   // 缝纫动框持续角度, 0--36000, 单位 0.01度，默认 15000
    m_allParasList.append(makeAParaItem(0,
                                        PARA_TYPE_WORK,
                                        MC_SORT_SETTING,
                                        39, 0, 0, PARA_VALUE_TYPE_INT,
                                        tr("Continuous angle of sewing frame"),// 缝纫动框持续角度
                                        15000, 0, 36000, 15000, 2, cod->toUnicode("°"), tr(""), //度
                                        tr(""),0, 0, 0x0021, operate));

    // // 穿线点坐标X 0--400000 单位0.01mm 默认0
     m_allParasList.append(makeAParaItem(0,
                                         PARA_TYPE_WORK,
                                         MC_SORT_SETTING,
                                         40, 0, 0, PARA_VALUE_TYPE_INT,
                                         tr("Coordinate of threading point X"),// 穿线点坐标X
                                         0, 0, 400000, 0, 2, tr("mm"), tr(""), //毫米
                                         tr(""),0, 0, 0x0021, operate));

     // 穿线点坐标Y 0--400000 单位0.01mm 默认0
      m_allParasList.append(makeAParaItem(0,
                                          PARA_TYPE_WORK,
                                          MC_SORT_SETTING,
                                          41, 0, 0, PARA_VALUE_TYPE_INT,
                                          tr("Coordinate of threading point Y"),// 穿线点坐标Y
                                          0, 0, 400000, 0, 2, tr("mm"), tr(""), //毫米
                                          tr(""),0, 0, 0x0021, operate));

      // 主轴启动停止转速, 范围 1--500，单位r/min，默认 500
      m_allParasList.append(makeAParaItem(0,
                                          PARA_TYPE_WORK,
                                          MC_SORT_SETTING,
                                          42, 0, 0, PARA_VALUE_TYPE_INT,
                                          tr("Spindle start stop speed"),// 主轴启动停止转速
                                          500, 1, 500, 500, 0, tr("r/min"), tr(""),
                                          tr(""),0, 0, 0x0021, operate));

      // 主轴运转加速度, 范围 1--500，单位r/ss，默认 500
      m_allParasList.append(makeAParaItem(0,
                                          PARA_TYPE_WORK,
                                          MC_SORT_SETTING,
                                          43, 0, 0, PARA_VALUE_TYPE_INT,
                                          tr("Spindle running acceleration"),// 主轴运转加速度
                                          500, 1, 500, 500, 0, tr("r/ss"), tr(""),
                                          tr(""),0, 0, 0x0021, operate));

        // 主轴刹车加速度, 范围 1--500，单位r/ss，默认 500
      m_allParasList.append(makeAParaItem(0,
                                          PARA_TYPE_WORK,
                                          MC_SORT_SETTING,
                                          44, 0, 0, PARA_VALUE_TYPE_INT,
                                          tr("Spindle brake acceleration "),// 主轴刹车加速度
                                          500, 1, 500, 500, 0, tr("r/ss"), tr(""),
                                          tr(""),0, 0, 0x0021, operate));

}

//电机和控制动作
void FiveHeadPrecisionSewing::initOutCtrlList()
{
    m_allOutCtrlList.clear();
    int showPriority = 1;

    m_allOutCtrlList.append(makeAOutCtrlItem(0,showPriority++,tr("Zero All"),MT_HX,// 全部归零
                                             "",false,-1,-1,-1,
                                             "",false,-1,-1,-1,
                                             "",false,-1,-1,-1,
                                             "",false,-1,-1,-1,
                                             zeroStr,true,ALLTO_ZERO,-1,-1));
    m_allOutCtrlList.append(creatZeroForwardReverseItem(0,showPriority++,tr("X to move motor"),MT_LX));// X向移动电机(归零,正转,反转)
    m_allOutCtrlList.append(creatZeroForwardReverseItem(0,showPriority++,tr("Y to move motor"),MT_LY));// Y向移动电机(归零,正转,反转)
    m_allOutCtrlList.append(makeAOutCtrlItem(0,showPriority++,tr("Head moving motor"),MT_HX,// 机头移动电机(归零)
                                             "",false,-1,-1,-1,
                                             "",false,-1,-1,-1,
                                             "",false,-1,-1,-1,
                                             "",false,-1,-1,-1,
                                             zeroStr,true,OUTCONTROL_ZERO,-1,-1));

    m_allOutCtrlList.append(creatZeroItem(0,showPriority++,tr("All spindle zero positions"),MT_ALLZ)); // 所有主轴 零位	(归零)
    m_allOutCtrlList.append(creatZeroItem(0,showPriority++,tr("All Spindle Hook Lines positions"),MT_ALLG));  // 所有主轴 勾线	(归零)
    m_allOutCtrlList.append(creatZeroItem(0,showPriority++,tr("All spindle jogs positions"),MT_ALLM)); // 所有主轴 点动	(归零)


    //同样的按钮组封装为一个方法
    m_allOutCtrlList.append(creatZeroForwardReverseItem(0,showPriority++,tr("Spindle 1 motor"),MT_LM1));// 主轴1电机	(归零,正转,反转)
    m_allOutCtrlList.append(creatZeroForwardReverseItem(0,showPriority++,tr("Pin 1 motor"),MT_LN1));// 针1电机
    m_allOutCtrlList.append(creatZeroForwardReverseItem(0,showPriority++,tr("Shuttle 1 motor"),MT_LH1));// 梭1电机

    m_allOutCtrlList.append(creatZeroForwardReverseItem(0,showPriority++,tr("Spindle 2 motor"),MT_LM2));// 主轴2电机
    m_allOutCtrlList.append(creatZeroForwardReverseItem(0,showPriority++,tr("Pin 2 motor"),MT_LN2));// 针2电机
    m_allOutCtrlList.append(creatZeroForwardReverseItem(0,showPriority++,tr("Shuttle 2 motor"),MT_LH2));// 梭2电机

    m_allOutCtrlList.append(creatZeroForwardReverseItem(0,showPriority++,tr("Spindle 3 motor"),MT_LM3));// 主轴3电机
    m_allOutCtrlList.append(creatZeroForwardReverseItem(0,showPriority++,tr("Pin 3 motor"),MT_LN3));// 针3电机
    m_allOutCtrlList.append(creatZeroForwardReverseItem(0,showPriority++,tr("Shuttle 3 motor"),MT_LH3));// 梭3电机

    m_allOutCtrlList.append(creatZeroForwardReverseItem(0,showPriority++,tr("Spindle 4 motor"),MT_LM4));// 主轴4电机
    m_allOutCtrlList.append(creatZeroForwardReverseItem(0,showPriority++,tr("Pin 4 motor"),MT_LN4));// 针4电机
    m_allOutCtrlList.append(creatZeroForwardReverseItem(0,showPriority++,tr("Shuttle 4 motor"),MT_LH4));// 梭4电机

    m_allOutCtrlList.append(creatZeroForwardReverseItem(0,showPriority++,tr("Spindle 5 motor"),MT_LM5));// 主轴5电机
    m_allOutCtrlList.append(creatZeroForwardReverseItem(0,showPriority++,tr("Pin 5 motor"),MT_LN5));// 针5电机
    m_allOutCtrlList.append(creatZeroForwardReverseItem(0,showPriority++,tr("Shuttle 5 motor"),MT_LH5));// 梭5电机


    m_allOutCtrlList.append(creatOpenCloseItem(0,showPriority++,tr("Head 1 Elastic thread"),OT_LOOSE_THREAD1));//机头1 松紧线	(放松,夹紧)
    m_allOutCtrlList.append(creatOpenCloseItem(0,showPriority++,tr("Head 2 Elastic thread"),OT_LOOSE_THREAD2));//机头2 松紧线
    m_allOutCtrlList.append(creatOpenCloseItem(0,showPriority++,tr("Head 3 Elastic thread"),OT_LOOSE_THREAD3));//机头3 松紧线
    m_allOutCtrlList.append(creatOpenCloseItem(0,showPriority++,tr("Head 4 Elastic thread"),OT_LOOSE_THREAD4));//机头4 松紧线
    m_allOutCtrlList.append(creatOpenCloseItem(0,showPriority++,tr("Head 5 Elastic thread"),OT_LOOSE_THREAD5));//机头5 松紧线

    m_allOutCtrlList.append(creatEnableItem(0,showPriority++,tr("Head 1 ThreadCuttingAction"), ThreadCuttingAction1,trimStr));   // 机头1 剪线动作
    m_allOutCtrlList.append(creatEnableItem(0,showPriority++,tr("Head 2 ThreadCuttingAction"), ThreadCuttingAction2,trimStr));   // 机头2 剪线动作
    m_allOutCtrlList.append(creatEnableItem(0,showPriority++,tr("Head 3 ThreadCuttingAction"), ThreadCuttingAction3,trimStr));   // 机头3 剪线动作
    m_allOutCtrlList.append(creatEnableItem(0,showPriority++,tr("Head 4 ThreadCuttingAction"), ThreadCuttingAction4,trimStr));   // 机头4 剪线动作
    m_allOutCtrlList.append(creatEnableItem(0,showPriority++,tr("Head 5 ThreadCuttingAction"), ThreadCuttingAction5,trimStr));   // 机头5 剪线动作

    m_allOutCtrlList.append(creatOpenCloseItem(0,showPriority++,tr("Head 1 blow"), OT_BLOW1));   // 机头1 吹气	(打开,关闭)
    m_allOutCtrlList.append(creatOpenCloseItem(0,showPriority++,tr("Head 2 blow"), OT_BLOW2));   // 机头2 吹气
    m_allOutCtrlList.append(creatOpenCloseItem(0,showPriority++,tr("Head 3 blow"), OT_BLOW3));   // 机头3 吹气
    m_allOutCtrlList.append(creatOpenCloseItem(0,showPriority++,tr("Head 4 blow"), OT_BLOW4));   // 机头4 吹气
    m_allOutCtrlList.append(creatOpenCloseItem(0,showPriority++,tr("Head 5 blow"), OT_BLOW5));   // 机头5 吹气

    m_allOutCtrlList.append(creatOpenCloseItem(0,showPriority++,tr("Head 1 trim"), OT_DCUT_THREAD1));   //机头1 剪线	 (打开,关闭)
    m_allOutCtrlList.append(creatOpenCloseItem(0,showPriority++,tr("Head 2 trim"), OT_DCUT_THREAD2));   //机头2 剪线
    m_allOutCtrlList.append(creatOpenCloseItem(0,showPriority++,tr("Head 3 trim"), OT_DCUT_THREAD3));   //机头3 剪线
    m_allOutCtrlList.append(creatOpenCloseItem(0,showPriority++,tr("Head 4 trim"), OT_DCUT_THREAD4));   //机头4 剪线
    m_allOutCtrlList.append(creatOpenCloseItem(0,showPriority++,tr("Head 5 trim"), OT_DCUT_THREAD5));   //机头5 剪线

    m_allOutCtrlList.append(creatOpenCloseItem(0,showPriority++,tr("Head 1 needle refueling"), OT_ADD_NOIL1));   //机头1 针加油	(打开,关闭)
    m_allOutCtrlList.append(creatOpenCloseItem(0,showPriority++,tr("Head 2 needle refueling"), OT_ADD_NOIL2));   //机头2 针加油
    m_allOutCtrlList.append(creatOpenCloseItem(0,showPriority++,tr("Head 3 needle refueling"), OT_ADD_NOIL3));   //机头3 针加油
    m_allOutCtrlList.append(creatOpenCloseItem(0,showPriority++,tr("Head 4 needle refueling"), OT_ADD_NOIL4));   //机头4 针加油
    m_allOutCtrlList.append(creatOpenCloseItem(0,showPriority++,tr("Head 5 needle refueling"), OT_ADD_NOIL5));   //机头5 针加油

    m_allOutCtrlList.append(creatOpenCloseItem(0,showPriority++,tr("Head 1 shuttle refueling"), OT_ADD_HOIL1));   // 机头1 梭加油	(打开,关闭)
    m_allOutCtrlList.append(creatOpenCloseItem(0,showPriority++,tr("Head 2 shuttle refueling"), OT_ADD_HOIL2));   // 机头2 梭加油
    m_allOutCtrlList.append(creatOpenCloseItem(0,showPriority++,tr("Head 3 shuttle refueling"), OT_ADD_HOIL3));   // 机头3 梭加油
    m_allOutCtrlList.append(creatOpenCloseItem(0,showPriority++,tr("Head 4 shuttle refueling"), OT_ADD_HOIL4));   // 机头4 梭加油
    m_allOutCtrlList.append(creatOpenCloseItem(0,showPriority++,tr("Head 5 shuttle refueling"), OT_ADD_HOIL5));   // 机头5 梭加油

    m_allOutCtrlList.append(creatAscendingDescendingItem(0,showPriority++,tr("Head 1 lifting"), OT_LIFT_UP1));   // 机头1 升降	(上升,下降)
    m_allOutCtrlList.append(creatAscendingDescendingItem(0,showPriority++,tr("Head 2 lifting"), OT_LIFT_UP2));   // 机头2 升降
    m_allOutCtrlList.append(creatAscendingDescendingItem(0,showPriority++,tr("Head 3 lifting"), OT_LIFT_UP3));   // 机头3 升降
    m_allOutCtrlList.append(creatAscendingDescendingItem(0,showPriority++,tr("Head 4 lifting"), OT_LIFT_UP4));   // 机头4 升降
    m_allOutCtrlList.append(creatAscendingDescendingItem(0,showPriority++,tr("Head 5 lifting"), OT_LIFT_UP5));   // 机头5 升降

    m_allOutCtrlList.append(creatOpenCloseItem(0,showPriority++,tr("Lock frame cylinder"), OT_LOCK_FRM_CTRL));   // 锁框气缸 (打开,关闭)
    m_allOutCtrlList.append(creatAscendingDescendingItem(0,showPriority++,tr("Flap control"), OT_FLAP_UP));   // 翻板控制 (上升,下降)
    m_allOutCtrlList.append(makeAOutCtrlItem(0,showPriority++,tr("Barcode testing"),OT_SCAN_CODE,  // 条码测试 (打开)
                                             "",false,-1,-1,-1,
                                             "",false,-1,-1,-1,
                                             "",false,-1,-1,-1,
                                             "",false,-1,-1,-1,
                                             openStr,true,OUTCONTROL_OPEN,-1,-1));

    m_allOutCtrlList.append(creatOpenCloseItem(0,showPriority++,tr("Head 1 Clamp wire"), OT_CLIP1));   // 机头1 夹线	(打开,关闭)
    m_allOutCtrlList.append(creatOpenCloseItem(0,showPriority++,tr("Head 2 Clamp wire"), OT_CLIP2));   // 机头2 夹线
    m_allOutCtrlList.append(creatOpenCloseItem(0,showPriority++,tr("Head 3 Clamp wire"), OT_CLIP3));   // 机头3 夹线
    m_allOutCtrlList.append(creatOpenCloseItem(0,showPriority++,tr("Head 4 Clamp wire"), OT_CLIP4));   // 机头4 夹线
    m_allOutCtrlList.append(creatOpenCloseItem(0,showPriority++,tr("Head 5 Clamp wire"), OT_CLIP5));   // 机头5 夹线
}


//快捷功能
void FiveHeadPrecisionSewing::initShortCutList()
{
    m_allShortCutList.clear();
    int index = 1;;
    m_allShortCutList.append(makeAShortCutItem(0,index++,tr("All Zero"),"buttonFrameZero",FUN_ALLTOZERO));//全部归零
    m_allShortCutList.append(makeAShortCutItem(0,index++,tr("Front Back"),"buttonForwardOrBack",FUN_FORWARDORBACK));// 快进快退
//    m_allShortCutList.append(makeAShortCutItem(0,index++,tr("AllSple Zero"),"buttonAllToZero",FUN_MT_ALLZ));//所有主轴零位
    m_allShortCutList.append(makeAShortCutItem(0,index++,tr("AllSple Hook"),"buttonFlatEmbHook",FUN_MT_ALLG));//所有主轴勾线
    m_allShortCutList.append(makeAShortCutItem(0,index++,tr("AllSple Jogs"),"buttonSpindleRotate",FUN_MT_ALLM));//所有主轴点动
    m_allShortCutList.append(makeAShortCutItem(0,index++,tr("N/S Proofread"),"buttonAutoParas",FUN_MAINSHAFT_ADJUST));//针梭校对
    m_allShortCutList.append(makeAShortCutItem(0,index++,tr("ProcReset"),"buttonProcessReset",FUN_PROCESSRESET));//流程复位


    m_allShortCutList.append(makeAShortCutItem(0,index++,tr("Makeup1"),"Makeup1",FUN_MAKEUP_HEAD1));// 机头1补缝
    m_allShortCutList.append(makeAShortCutItem(0,index++,tr("Makeup2"),"Makeup2",FUN_MAKEUP_HEAD2));// 机头2补缝
    m_allShortCutList.append(makeAShortCutItem(0,index++,tr("Makeup3"),"Makeup3",FUN_MAKEUP_HEAD3));// 机头3补缝
    m_allShortCutList.append(makeAShortCutItem(0,index++,tr("Makeup4"),"Makeup4",FUN_MAKEUP_HEAD4));// 机头4补缝
    m_allShortCutList.append(makeAShortCutItem(0,index++,tr("Makeup5"),"Makeup5",FUN_MAKEUP_HEAD5));// 机头5补缝
    m_allShortCutList.append(makeAShortCutItem(0,index++,tr(""),"",FUN_NULL));//
    m_allShortCutList.append(makeAShortCutItem(0,index++,tr("Makeup Canl"),"MakeupCancel",FUN_MAKEUP_NOHEAD));// 取消补缝
//    m_allShortCutList.append(makeAShortCutItem(0,index++,tr("SetStart Point"),"buttonSetEmbPoint",FUN_SETSTARTPOINT));//定起始点
    m_allShortCutList.append(makeAShortCutItem(0,index++,tr("Back FeedtPoint"),"buttonEmbParas",FUN_GOTO_FEEDT));//回穿线点
    m_allShortCutList.append(makeAShortCutItem(0, index++, tr("Back StartPoint"),"buttonBackEmbPoint",FUN_BACKSTARTPOINT));//回起针点

//    m_allShortCutList.append(makeAShortCutItem(0,index++,tr("AllMain ShaftRun"),"buttonSetAnchorPoint",FUN_SPINDLETEST));// 所有主轴研车

    m_allShortCutList.append(makeAShortCutItem(0,index++,tr("Simulate"),"buttonSimulatedStatus",FUN_SIMULATED_STATUS));//模拟缝纫
    m_allShortCutList.append(makeAShortCutItem(0,index++,tr("Head Lifting"),"buttonHeadLifting",FUN_HEAD_LIFTING));//机头上升
    m_allShortCutList.append(makeAShortCutItem(0,index++,tr("SetStart Point"),"buttonSetEmbPoint",FUN_SETSTARTPOINT));//定起始点
//    m_allShortCutList.append(makeAShortCutItem(0,index++,tr(""),"",FUN_NULL));//

    m_allShortCutList.append(makeAShortCutItem(0,index++,tr("ThCutAct1"),"ThCutAct1",ASSIST_ThCutAct1));//机头1 剪线动作
    m_allShortCutList.append(makeAShortCutItem(0,index++,tr("ThCutAct2"),"ThCutAct2",ASSIST_ThCutAct2));//机头2 剪线动作
    m_allShortCutList.append(makeAShortCutItem(0,index++,tr("ThCutAct3"),"ThCutAct3",ASSIST_ThCutAct3));//机头3 剪线动作
    m_allShortCutList.append(makeAShortCutItem(0,index++,tr("ThCutAct4"),"ThCutAct4",ASSIST_ThCutAct4));//机头4 剪线动作
    m_allShortCutList.append(makeAShortCutItem(0,index++,tr("ThCutAct5"),"ThCutAct5",ASSIST_ThCutAct5));//机头5 剪线动作

}

//辅助功能
void FiveHeadPrecisionSewing::initAssistList()
{
    m_allAssistList.clear();

    m_allAssistList.append(makeAAssistItem(0,0x0001,tr("Signal"),"buttonSensor",ASSIST_SENSOR));//传感器信号
    m_allAssistList.append(makeAAssistItem(0,0x0002,tr("Action"),"buttonControlAction",ASSIST_CONTROLACTION));//控制动作
    m_allAssistList.append(makeAAssistItem(0,0x0003,tr("HMI Upgrade"),"buttonHMIUpgrade",ASSIST_HMIUPGRADE));//界面升级
    m_allAssistList.append(makeAAssistItem(0,0x0004,tr("MC Upgrade"),"buttonMCUpgrade",ASSIST_MCUPGRADE));//主控升级
    m_allAssistList.append(makeAAssistItem(0,0x0006,tr("Para Import"),"buttonParaImport",ASSIST_PARAIMPORT));//参数导入
    m_allAssistList.append(makeAAssistItem(0,0x0007,tr("Para Export"),"buttonParaExport",ASSIST_PARAEXPORT));//参数导出
    m_allAssistList.append(makeAAssistItem(0,0x0008,tr("Setting"),"buttonSoftwareSet",ASSIST_SOFTWARESET));//软件设置
    m_allAssistList.append(makeAAssistItem(0,0x0009,tr("Authorize"),"buttonSoftwareAuthor",ASSIST_AUTHORIZATION));//软件授权
    m_allAssistList.append(makeAAssistItem(0,0x000A,tr("Network"),"buttonNetworkManage",ASSIST_NETWORK));//网络管理
    m_allAssistList.append(makeAAssistItem(0,0x000C,tr("Time"),"buttonTimeSet",ASSIST_TIMESET));//时间设置
    m_allAssistList.append(makeAAssistItem(0,0x000F,tr("Version"),"buttonVersionInfo",ASSIST_MCVERSION));//版本信息
    m_allAssistList.append(makeAAssistItem(0,0x0014,tr("Root"),"buttonRoot",ASSIST_ROOT));//超级用户
    m_allAssistList.append(makeAAssistItem(0,0x0015,tr("HMIreturn"),"buttonActionSet",ASSIST_HMIBACKUPSUPGRADE));//界面还原
//    m_allAssistList.append(makeAAssistItem(0,0x001A,tr("ScanTest"),"ScanTest",ASSIST_ScanTest));//扫码测试
}

//花样设置
void FiveHeadPrecisionSewing::initPatternSetList()
{
    m_allPatternSetList.clear();

    m_allPatternSetList.append(makeAPatternSetItem(0,0x0001,tr("Para"),"buttonPatternPara",PATTERNSET_PATTERNPARA));//花样参数
    m_allPatternSetList.append(makeAPatternSetItem(0,0x0002,tr("Select"),"buttonPatternSelect",PATTERNSET_PATTERNSELECT));//花样选择
    m_allPatternSetList.append(makeAPatternSetItem(0,0x0004,tr("Import"),"buttonPatternImport",PATTERNSET_PATTERNIMPORT));//花样导入
    m_allPatternSetList.append(makeAPatternSetItem(0,0x0005,tr("Export"),"buttonPatternExport",PATTERNSET_PATTERNEXPORT));//花样导出
    m_allPatternSetList.append(makeAPatternSetItem(0,0x0006,tr("Delete"),"buttonPatternDelete",PATTERNSET_PATTERNDELETE));//花样删除
}


//参数分类(参数分组功能)
void FiveHeadPrecisionSewing::initParaSetList()
{
    m_allParaSetList.clear();

    m_allParaSetList.append(makeAParaSetItem(0,0x0001,tr("OperatPara"),"buttonPositionParas",PARASET_SETTING));//设置参数  //操作参数
    m_allParaSetList.append(makeAParaSetItem(0,0x0002,tr("ActionSet"),"buttonSpeedParas",PARASET_ACTION));//动作参数   //动作设定
    m_allParaSetList.append(makeAParaSetItem(0,0x0003,tr("SpeedPara"),"buttonActionParas",PARASET_SPEED));//速度参数  //速度控制参数
    m_allParaSetList.append(makeAParaSetItem(0,0x0004,tr("LimitPara"),"buttonDetectParas",PARASET_POSITION));// 位置参数  //限位参数
    m_allParaSetList.append(makeAParaSetItem(0,0x0005,tr("MCPara"),"buttonSettingParas",PARASET_DETECT));//设置参数    //机器参数
}


//初始化传感器列表
void FiveHeadPrecisionSewing::initSensorList()
{
    QList <SensorItem> sensorList;

    sensorList.append(makeASensorItem(0x0000, 0, tr("Start button 1")));//启动按钮1
    sensorList.append(makeASensorItem(0x0001, 0, tr("Pause button 1")));//暂停按钮1
    sensorList.append(makeASensorItem(0x0002, 0, tr("Jog button 1")));//点动按钮1
    sensorList.append(makeASensorItem(0x0003, 0, tr("Open frame button 1")));//开框按钮1
    sensorList.append(makeASensorItem(0x0004, 0, tr("Manual operation button 1")));//手动按钮1
    sensorList.append(makeASensorItem(0x0005, 0, tr("Be ready button 1")));//就绪按钮1
    sensorList.append(makeASensorItem(0x0006, 0, tr("Key button 1")));//钥匙按钮1
    sensorList.append(makeASensorItem(0x0007, 0, tr("Air pressure detection 1")));//气压检测1
    sensorList.append(makeASensorItem(0x0008, 0, tr("Security input 1")));//安全输入1
    sensorList.append(makeASensorItem(0x0009, 0, tr("Template in position 1")));//模板到位1
    sensorList.append(makeASensorItem(0x0009, 1, tr("Template in position 2")));//模板到位2
    sensorList.append(makeASensorItem(0x000A, 0, tr("MOTOR_ALM1")));//电机报警1
    sensorList.append(makeASensorItem(0x000B, 0, tr("MOTOR_ALM9")));//电机报警9
    sensorList.append(makeASensorItem(0x000C, 0, tr("MOTOR_ALM17")));//电机报警17
    sensorList.append(makeASensorItem(0x000D, 0, tr("MOTOR_ALM25")));//电机报警25
    sensorList.append(makeASensorItem(0x000E, 0, tr("MOTOR_ALM33")));//电机报警33
    sensorList.append(makeASensorItem(0x000F, 0, tr("MOTOR_ALM41")));//电机报警41

    sensorList.append(makeASensorItem(0x0020, 0, tr("X zero position")));//X零位
    sensorList.append(makeASensorItem(0x0020, 1, tr("Y zero position")));//Y零位
    sensorList.append(makeASensorItem(0x0021, 0, tr("X deceleration")));//X降速
    sensorList.append(makeASensorItem(0x0021, 1, tr("Y deceleration")));//Y降速
    sensorList.append(makeASensorItem(0x0022, 0, tr("X negative limit")));//X负限位
    sensorList.append(makeASensorItem(0x0022, 1, tr("Y negative limit")));//Y负限位

    sensorList.append(makeASensorItem(0x0023, 0, tr("X positive limit")));//X正限位
    sensorList.append(makeASensorItem(0x0023, 1, tr("Y positive limit")));//Y正限位

    for(int i = 0; i < 5; i++)
        sensorList.append(makeASensorItem(0x0040, i, tr("Lifting upper limit ") + QString::number(i+1)));//机头高位

    for(int i = 0; i < 5; i++)
        sensorList.append(makeASensorItem(0x0042, i, tr("Lifting lower limit ") + QString::number(i+1)));//机头低位


    QString moveZeroUp = tr("Move Zero Up ");       //上移零位
    QString moveZeroDown = tr("Move Zero Down ");       //下移零位
    sensorList.append(makeASensorItem(0x0060, 2, moveZeroUp + QString::number(2)));//机头2上移零位
    sensorList.append(makeASensorItem(0x0060, 4, moveZeroUp + QString::number(3)));//机头3上移零位
    sensorList.append(makeASensorItem(0x0060, 6, moveZeroUp + QString::number(4)));//机头4上移零位
    sensorList.append(makeASensorItem(0x0060, 3, moveZeroDown + QString::number(2)));//机头2下移零位
    sensorList.append(makeASensorItem(0x0060, 5, moveZeroDown + QString::number(3)));//机头3下移零位
    sensorList.append(makeASensorItem(0x0060, 7, moveZeroDown + QString::number(4)));//机头4下移零位

    QString upSlowDown = tr("Up slow down ");       //上移降速
    QString DownSlowDown = tr("Down slow down ");       //下移降速
    sensorList.append(makeASensorItem(0x0061, 2, upSlowDown + QString::number(2)));//机头2上移降速
    sensorList.append(makeASensorItem(0x0061, 4, upSlowDown + QString::number(3)));//机头3上移降速
    sensorList.append(makeASensorItem(0x0061, 6, upSlowDown + QString::number(4)));//机头4上移降速
    sensorList.append(makeASensorItem(0x0061, 3, DownSlowDown +QString::number(2)));//机头2下移降速
    sensorList.append(makeASensorItem(0x0061, 5, DownSlowDown +QString::number(3)));//机头3下移降速
    sensorList.append(makeASensorItem(0x0061, 7, DownSlowDown +QString::number(4)));//机头4下移降速

    QString upshiftLimit = tr("Upshift limit ");       //上移限位
    QString lowerLimit = tr("Lower limit ");       //下移限位
    sensorList.append(makeASensorItem(0x0063, 0, upshiftLimit + QString::number(1) ));//机头1上移限位
    sensorList.append(makeASensorItem(0x0063, 2, upshiftLimit + QString::number(2) ));//机头2上移限位
    sensorList.append(makeASensorItem(0x0063, 4, upshiftLimit + QString::number(3) ));//机头3上移限位
    sensorList.append(makeASensorItem(0x0063, 6, upshiftLimit + QString::number(4) ));//机头4上移限位
    sensorList.append(makeASensorItem(0x0063, 1, lowerLimit + QString::number(1)));//机头1下移限位
    sensorList.append(makeASensorItem(0x0063, 3, lowerLimit + QString::number(2)));//机头2下移限位
    sensorList.append(makeASensorItem(0x0063, 5, lowerLimit + QString::number(3)));//机头3下移限位
    sensorList.append(makeASensorItem(0x0063, 7, lowerLimit + QString::number(4)));//机头4下移限位

    sensorList.append(makeASensorItem(0x0064, 0, moveZeroUp + QString::number(5)));//机头5上移零位
    sensorList.append(makeASensorItem(0x0064, 1, moveZeroDown + QString::number(5)));//机头5下移零位

    sensorList.append(makeASensorItem(0x0065, 0, upSlowDown + QString::number(6)));//机头6上移降速
    sensorList.append(makeASensorItem(0x0065, 1, DownSlowDown + QString::number(6)));//机头6下移降速

    sensorList.append(makeASensorItem(0x0067, 0, upshiftLimit + QString::number(5)));//机头5上移限位
    sensorList.append(makeASensorItem(0x0067, 1, lowerLimit + QString::number(5)));//机头5下移限位

    for(int i = 0; i < 5; i++)
        sensorList.append(makeASensorItem(0x0080, i, tr("Needle zero position ") + QString::number(i+1)));//针零位

    for(int i = 0; i < 5; i++)
        sensorList.append(makeASensorItem(0x0088, i, tr("Shuttle zero position ") + QString::number(i+1)));//梭零位

    for(int i = 0; i < 5; i++)
        sensorList.append(makeASensorItem(0x0170, i, tr("Thread breakage inspection ") + QString::number(i+1)));//面线断检

    for(int i = 0; i < 5; i++)
        sensorList.append(makeASensorItem(0x0174, i, tr("Thread trimming return ") + QString::number(i+1)));//剪刀回位

    //将机型所需的传感器列表替换到传感器整体列表中
    for(int i = 0; i < sensorList.size(); i++)
    {
        int byteaddr = sensorList[i].m_byte_offset;
        int bitaddr = sensorList[i].m_bit_offset;
        QString str = sensorList[i].m_name;
        int type = sensorList[i].m_type;

        int idx = byteaddr*8+bitaddr;
        if(idx < m_allSensorList.size())
        {
            m_allSensorList[idx].m_name = str;
            m_allSensorList[idx].m_type = type;
        }
    }
}

#define	STA_BREAK1_ROLL			0x0259		// 机头1断线
#define	STA_BREAK2_ROLL			0x025A		// 机头2断线
#define	STA_BREAK3_ROLL			0x025B		// 机头3断线
#define	STA_BREAK4_ROLL			0x025C		// 机头4断线
#define	STA_BREAK5_ROLL			0x025D		// 机头5断线

//初始化错误代码和状态列表      //五头未更改
void FiveHeadPrecisionSewing::initErrorCodeAndStateList()
{
    m_allErrorCodeAndStateList.clear();

    QString threadBreak = tr("Head wire breakage,Head:");//机头断线，机头：
    m_allErrorCodeAndStateList.append(makeAErrorStateItem(STA_BREAK1_ROLL,threadBreak + QString::number(1)));
    m_allErrorCodeAndStateList.append(makeAErrorStateItem(STA_BREAK2_ROLL,threadBreak + QString::number(2)));
    m_allErrorCodeAndStateList.append(makeAErrorStateItem(STA_BREAK3_ROLL,threadBreak + QString::number(3)));
    m_allErrorCodeAndStateList.append(makeAErrorStateItem(STA_BREAK4_ROLL,threadBreak + QString::number(4)));
    m_allErrorCodeAndStateList.append(makeAErrorStateItem(STA_BREAK5_ROLL,threadBreak + QString::number(5)));

    m_allErrorCodeAndStateList.append(makeAErrorStateItem(ERRQUI_NONE,tr("freedom from error")));               // 没有错误
    m_allErrorCodeAndStateList.append(makeAErrorStateItem(ERRQUI_NO_POWER,tr("Not powered on")));       // 没有上电
    m_allErrorCodeAndStateList.append(makeAErrorStateItem(ERRQUI_NO_AIR,tr("Insufficient air pressure")));         // 气压不足
    m_allErrorCodeAndStateList.append(makeAErrorStateItem(ERRQUI_NOT_SAFE,tr("Safe Area Intervention")));       // 安全区域介入
    m_allErrorCodeAndStateList.append(makeAErrorStateItem(ERRQUI_EXPIRATION,tr("The usage deadline has expired")));     // 使用时限已到
    m_allErrorCodeAndStateList.append(makeAErrorStateItem(ERRQUI_FILL_DATA,tr("Filling data error")));              // 填充数据错误
    m_allErrorCodeAndStateList.append(makeAErrorStateItem(ERRQUI_NOT_ALLOWED,tr("Working status not allowed")));        // 不允许工作状态
    m_allErrorCodeAndStateList.append(makeAErrorStateItem(ERRQUI_CTRL_ERR,tr("control error")));               // 控制错误
    m_allErrorCodeAndStateList.append(makeAErrorStateItem(ERRQUI_FPGA_ERR,tr("Motion control chip version error")));            // 运动控制芯片版本错误
    m_allErrorCodeAndStateList.append(makeAErrorStateItem(ERRQUI_BUTTON_NOUP,tr("Waiting for button to lift timeout")));       // 等待按钮抬起超时
    m_allErrorCodeAndStateList.append(makeAErrorStateItem(ERRQUI_FPGA_RESET,tr("FPGA reset error")));        // FPGA复位错误
    m_allErrorCodeAndStateList.append(makeAErrorStateItem(ERRQUI_NO_READY,tr("Peripheral not ready")));          // 外设未就绪
    m_allErrorCodeAndStateList.append(makeAErrorStateItem(ERRQUI_NO_SEND_ERR,tr("Transmission data error")));       // 传输数据错误
    m_allErrorCodeAndStateList.append(makeAErrorStateItem(ERRQUI_EDTION_ERR,tr("Program version error")));        // 程序版本错误
    m_allErrorCodeAndStateList.append(makeAErrorStateItem(ERRQUI_WORK_DONE,tr("Production completed")));         // 完成产量

    m_allErrorCodeAndStateList.append(makeAErrorStateItem(ERRQUI_LMT_POSITIVE,tr("forward limit")));        // 正向限位
    m_allErrorCodeAndStateList.append(makeAErrorStateItem(ERRQUI_LMT_NEGATIVE,tr("Reverse limit")));        // 反向限位
    m_allErrorCodeAndStateList.append(makeAErrorStateItem(ERRQUI_RUN_ALM,tr("Motion alarm")));             // 运动报警
    m_allErrorCodeAndStateList.append(makeAErrorStateItem(ERRQUI_RUN_LIMIT,tr("Motion limit")));           // 运动限位
    m_allErrorCodeAndStateList.append(makeAErrorStateItem(ERRQUI_RUN_EMS,tr("Exercise emergency stop")));             // 运动急停
    m_allErrorCodeAndStateList.append(makeAErrorStateItem(ERRQUI_MV_PARA,tr("Motion parameter error")));             // 运动参数错误
    m_allErrorCodeAndStateList.append(makeAErrorStateItem(ERRQUI_MC_PARA,tr("Machine parameter error")));             // 机器参数错误
    m_allErrorCodeAndStateList.append(makeAErrorStateItem(ERRQUI_IN_PARA,tr("Input parameter error")));             // 输入参数错误
    m_allErrorCodeAndStateList.append(makeAErrorStateItem(ERRQUI_CUTTER_NORMAL,tr("The file is correct")));       // 文件正确
    m_allErrorCodeAndStateList.append(makeAErrorStateItem(ERRQUI_CUTTER_WAIT,tr("Waiting for files")));         // 等待文件

    m_allErrorCodeAndStateList.append(makeAErrorStateItem(ERRQUI_MTZ_RIGHT,tr("Zero successfully")));          // 归零成功
    m_allErrorCodeAndStateList.append(makeAErrorStateItem(ERRQUI_MTZ_ERROR,tr("Zero error")));          // 归零错误
    m_allErrorCodeAndStateList.append(makeAErrorStateItem(ERRQUI_COOR_SYSTM,tr("Coordinate system error")));         // 坐标系统错误
    m_allErrorCodeAndStateList.append(makeAErrorStateItem(ERRQUI_OUT_RANGE,tr("Target position out of range")));          // 目标位置越界
    m_allErrorCodeAndStateList.append(makeAErrorStateItem(ERRQUI_X_LIT_POSI,tr("X forward limit")));         // X正向限位
    m_allErrorCodeAndStateList.append(makeAErrorStateItem(ERRQUI_X_LIT_NEGA,tr("X reverse limit")));         // X反向限位
    m_allErrorCodeAndStateList.append(makeAErrorStateItem(ERRQUI_Y_LIT_POSI,tr("Y forward limit")));         // Y正向限位
    m_allErrorCodeAndStateList.append(makeAErrorStateItem(ERRQUI_Y_LIT_NEGA,tr("Y reverse limit")));         // Y反向限位

    m_allErrorCodeAndStateList.append(makeAErrorStateItem(ERRQUI_NO_DATA,tr("No Data")));        // 无数据
    m_allErrorCodeAndStateList.append(makeAErrorStateItem(ERRQUI_DATA_ERROR,tr("data error")));     // 数据错误


    m_allErrorCodeAndStateList.append(makeAErrorStateItem(ERRQUI_MS_NOT_ZERO,tr("Spindle not in zero position")));        // 主轴不在零位
    m_allErrorCodeAndStateList.append(makeAErrorStateItem(ERRQUI_HK_NOT_ZERO,tr("Rotary shuttle not in zero position")));        // 旋梭不在零位
    m_allErrorCodeAndStateList.append(makeAErrorStateItem(ERRQUI_MS_NOT_SYNC,tr("Needle shuttle out of sync")));        // 针梭不同步
    m_allErrorCodeAndStateList.append(makeAErrorStateItem(ERRQUI_RO_NOT_SYNC,tr("Rotation out of sync")));        // 旋转不同步
    m_allErrorCodeAndStateList.append(makeAErrorStateItem(ERRQUI_CUTTER_NOT_POS,tr("The scissors are not returning to their original position")));     // 剪刀不在回位(注:该报错码是缝纫剪刀)
    m_allErrorCodeAndStateList.append(makeAErrorStateItem(ERRQUI_HEAD_NOT_HIGH,tr("Machine head not in high position")));      // 机头不在高位
    m_allErrorCodeAndStateList.append(makeAErrorStateItem(ERRQUI_HEAD_NOT_LOW,tr("Machine head not in low position")));       // 机头不在低位
    m_allErrorCodeAndStateList.append(makeAErrorStateItem(ERRQUI_LIGHTCURTAINS,tr("Light curtain intervention")));         // 光幕介入
    m_allErrorCodeAndStateList.append(makeAErrorStateItem(ERRQUI_UPER_TBREAK,tr("Broken surface thread")));            // 面线断线
    m_allErrorCodeAndStateList.append(makeAErrorStateItem(ERRQUI_BOBBIN_TBREAK,tr("Bottom line disconnection")));        // 底线断线
    m_allErrorCodeAndStateList.append(makeAErrorStateItem(ERRQUI_LIFT_TIMEOUT,tr("Head lifting timeout")));            // 机头升降超时
    m_allErrorCodeAndStateList.append(makeAErrorStateItem(ERRQUI_CHANGE_BOBBIN,tr("Replacing the shuttle core")));       // 更换梭芯


    m_allErrorCodeAndStateList.append(makeAErrorStateItem(ERRQUI_FEED_ROLLER,tr("Abnormal feeding pressure roller")));        // 进料压辊 异常
    m_allErrorCodeAndStateList.append(makeAErrorStateItem(ERRQUI_DIS_ROLLER,tr("Abnormal discharge pressure roller")));         // 出料压辊 异常
    m_allErrorCodeAndStateList.append(makeAErrorStateItem(ERRQUI_DIS_MATERIAL,tr("Abnormal discharge and pressing")));       // 出料压料 异常
    m_allErrorCodeAndStateList.append(makeAErrorStateItem(ERRQUI_TENS_DEVICE,tr("Tensioning device abnormal")));        // 张紧装置 异常
    m_allErrorCodeAndStateList.append(makeAErrorStateItem(ERRQUI_CLOTH_DEVICE,tr("Abnormal cloth clamping device")));       // 夹布装置 异常
    m_allErrorCodeAndStateList.append(makeAErrorStateItem(ERRQUI_EDGE_MOTOR,tr("Edge cutting motor blocked")));         // 边切电机 阻塞
    m_allErrorCodeAndStateList.append(makeAErrorStateItem(ERRQUI_CROSS_MOTOR,tr("Cross cutting motor abnormality")));        // 横切电机 异常

    m_allErrorCodeAndStateList.append(makeAErrorStateItem(ERRQUI_INSTALLMENT_OK,tr("Password set successfully")));     // 密码设置成功
    m_allErrorCodeAndStateList.append(makeAErrorStateItem(ERRQUI_INSTALLMENT_FAIL,tr("Password setting failed")));   // 密码设置失败

    m_allErrorCodeAndStateList.append(makeAErrorStateItem(ERRQUI_MOTO_N_ALM,tr("Needle motor alarm")));         // 针电机报警
    m_allErrorCodeAndStateList.append(makeAErrorStateItem(ERRQUI_MOTO_H_ALM,tr("Shuttle motor alarm")));         // 梭电机报警
    m_allErrorCodeAndStateList.append(makeAErrorStateItem(ERRQUI_MOTO_X_ALM,tr("X motor alarm")));         // X电机报警
    m_allErrorCodeAndStateList.append(makeAErrorStateItem(ERRQUI_MOTO_Y_ALM,tr("Y motor alarm")));         // Y电机报警

    m_allErrorCodeAndStateList.append(makeAErrorStateItem(ERRQUI_MOTO_N_FZ,tr("Needle motor reset failed")));          // 针电机归零失败
    m_allErrorCodeAndStateList.append(makeAErrorStateItem(ERRQUI_MOTO_H_FZ,tr("Shuttle motor reset failed")));          // 梭电机归零失败
    m_allErrorCodeAndStateList.append(makeAErrorStateItem(ERRQUI_MOTO_X_FZ,tr("X motor reset failed")));          // X电机归零失败
    m_allErrorCodeAndStateList.append(makeAErrorStateItem(ERRQUI_MOTO_Y_FZ,tr("Y motor reset failed")));          // Y电机归零失败

    m_allErrorCodeAndStateList.append(makeAErrorStateItem(ERRQUI_CS_TIMEOUT,tr("Slave board communication timeout")));         // 从板通讯超时
    m_allErrorCodeAndStateList.append(makeAErrorStateItem(ERRQUI_MOTO_X_ZERO,tr("X motor not in zero position")));        // X电机不在零位

    m_allErrorCodeAndStateList.append(makeAErrorStateItem(ERR_HEAD_NOT_HIGH,tr("Machine head not in high position")));     // 机头不在高位
    m_allErrorCodeAndStateList.append(makeAErrorStateItem(ERR_X_LIT_POSI,tr("X forward limit")));        // X正向限位
    m_allErrorCodeAndStateList.append(makeAErrorStateItem(ERR_X_LIT_NEGA,tr("X reverse limit")));        // X反向限位
    m_allErrorCodeAndStateList.append(makeAErrorStateItem(ERR_Y_LIT_POSI,tr("Y forward limit")));        // Y正向限位
    m_allErrorCodeAndStateList.append(makeAErrorStateItem(ERR_Y_LIT_NEGA,tr("Y reverse limit")));        // Y反向限位
    m_allErrorCodeAndStateList.append(makeAErrorStateItem(ERR_COOR_SYSTM,tr("Coordinate system error")));        // 坐标系统错误
    m_allErrorCodeAndStateList.append(makeAErrorStateItem(ERR_OUT_RANGE,tr("Target position out of range")));         // 目标位置越界
    m_allErrorCodeAndStateList.append(makeAErrorStateItem(ERR_NOT_SAFE,tr("Safe Area Intervention")));          // 安全区域介入
    m_allErrorCodeAndStateList.append(makeAErrorStateItem(ERR_AIR_POWER,tr("Insufficient air pressure")));         // 气压不足
    m_allErrorCodeAndStateList.append(makeAErrorStateItem(ERR_GUARDRAIL_OPEN,tr("The safety door is not closed")));    // 安全门未关闭
    m_allErrorCodeAndStateList.append(makeAErrorStateItem(ERR_UPER_TBREAK,tr("Broken surface thread")));       // 面线断线
    m_allErrorCodeAndStateList.append(makeAErrorStateItem(ERR_CHANGE_BOBBIN,tr("Replacing the shuttle core")));     // 更换梭芯
    m_allErrorCodeAndStateList.append(makeAErrorStateItem(ERR_MS_NOT_ZERO,tr("Spindle not in zero position")));       // 主轴不在零位
    m_allErrorCodeAndStateList.append(makeAErrorStateItem(ERR_HK_NOT_ZERO,tr("Rotary shuttle not in zero position")));       // 旋梭不在零位
    m_allErrorCodeAndStateList.append(makeAErrorStateItem(ERR_NO_DATA,tr("No Data")));           // 无数据
    m_allErrorCodeAndStateList.append(makeAErrorStateItem(ERR_MC_PARA,tr("Machine parameter error")));           // 机器参数错误
    m_allErrorCodeAndStateList.append(makeAErrorStateItem(ERR_MV_PARA,tr("Motion parameter error")));           // 运动参数错误
    m_allErrorCodeAndStateList.append(makeAErrorStateItem(ERR_HEAD_NOT_SAFE,tr("The machine head is not in a safe area")));     // 机头不在安全区域
    m_allErrorCodeAndStateList.append(makeAErrorStateItem(ERR_NOT_ALLOWED,tr("Working status not allowed")));       // 不允许工作状态
    m_allErrorCodeAndStateList.append(makeAErrorStateItem(ERR_LIFT_TIMEOUT,tr("Head lifting timeout")));      // 机头升降超时
    m_allErrorCodeAndStateList.append(makeAErrorStateItem(ERR_NOT_AT_POS,tr("Template not in place")));        // 模版不到位
    m_allErrorCodeAndStateList.append(makeAErrorStateItem(ERR_EXPIRATION,tr("The usage deadline has expired")));        // 使用时限已到
    m_allErrorCodeAndStateList.append(makeAErrorStateItem(ERR_IN_PARA,tr("Input parameter error")));           // 输入参数错误
    QString str = tr("The scissors are not returning to their original position");//剪刀不在回位
    m_allErrorCodeAndStateList.append(makeAErrorStateItem(ERR_HD1_CUTTER_NOT_POS, str + QString::number(1)));
    m_allErrorCodeAndStateList.append(makeAErrorStateItem(ERR_HD2_CUTTER_NOT_POS, str + QString::number(2)));
    m_allErrorCodeAndStateList.append(makeAErrorStateItem(ERR_HD3_CUTTER_NOT_POS, str + QString::number(3)));
    m_allErrorCodeAndStateList.append(makeAErrorStateItem(ERR_HD4_CUTTER_NOT_POS, str + QString::number(4)));
    m_allErrorCodeAndStateList.append(makeAErrorStateItem(ERR_HD5_CUTTER_NOT_POS, str + QString::number(5)));


}
